﻿using System;
using System.Text;

namespace HslCommunication.Core.IMessage
{
	/// <summary>
	/// 基于MC协议的Qna兼容3E帧协议的ASCII通讯消息机制
	/// </summary>
	// Token: 0x0200015E RID: 350
	public class MelsecQnA3EAsciiMessage : INetMessage
	{
		/// <inheritdoc cref="P:HslCommunication.Core.IMessage.INetMessage.ProtocolHeadBytesLength" />
		// Token: 0x170005F7 RID: 1527
		// (get) Token: 0x06001D83 RID: 7555 RVA: 0x0008CF06 File Offset: 0x0008B106
		public int ProtocolHeadBytesLength
		{
			get
			{
				return 18;
			}
		}

		/// <inheritdoc cref="M:HslCommunication.Core.IMessage.INetMessage.GetContentLengthByHeadBytes" />
		// Token: 0x06001D84 RID: 7556 RVA: 0x0008D844 File Offset: 0x0008BA44
		public int GetContentLengthByHeadBytes()
		{
			byte[] bytes = new byte[]
			{
				this.HeadBytes[14],
				this.HeadBytes[15],
				this.HeadBytes[16],
				this.HeadBytes[17]
			};
			return Convert.ToInt32(Encoding.ASCII.GetString(bytes), 16);
		}

		/// <inheritdoc cref="M:HslCommunication.Core.IMessage.INetMessage.CheckHeadBytesLegal(System.Byte[])" />
		// Token: 0x06001D85 RID: 7557 RVA: 0x0008D8A0 File Offset: 0x0008BAA0
		public bool CheckHeadBytesLegal(byte[] token)
		{
			bool flag = this.HeadBytes == null;
			bool result;
			if (flag)
			{
				result = false;
			}
			else
			{
				bool flag2 = this.HeadBytes[0] == 68 && this.HeadBytes[1] == 48 && this.HeadBytes[2] == 48 && this.HeadBytes[3] == 48;
				result = flag2;
			}
			return result;
		}

		/// <inheritdoc cref="M:HslCommunication.Core.IMessage.INetMessage.GetHeadBytesIdentity" />
		// Token: 0x06001D86 RID: 7558 RVA: 0x00047BE1 File Offset: 0x00045DE1
		public int GetHeadBytesIdentity()
		{
			return 0;
		}

		/// <inheritdoc cref="P:HslCommunication.Core.IMessage.INetMessage.HeadBytes" />
		// Token: 0x170005F8 RID: 1528
		// (get) Token: 0x06001D87 RID: 7559 RVA: 0x0008D8FF File Offset: 0x0008BAFF
		// (set) Token: 0x06001D88 RID: 7560 RVA: 0x0008D907 File Offset: 0x0008BB07
		public byte[] HeadBytes { get; set; }

		/// <inheritdoc cref="P:HslCommunication.Core.IMessage.INetMessage.ContentBytes" />
		// Token: 0x170005F9 RID: 1529
		// (get) Token: 0x06001D89 RID: 7561 RVA: 0x0008D910 File Offset: 0x0008BB10
		// (set) Token: 0x06001D8A RID: 7562 RVA: 0x0008D918 File Offset: 0x0008BB18
		public byte[] ContentBytes { get; set; }

		/// <inheritdoc cref="P:HslCommunication.Core.IMessage.INetMessage.SendBytes" />
		// Token: 0x170005FA RID: 1530
		// (get) Token: 0x06001D8B RID: 7563 RVA: 0x0008D921 File Offset: 0x0008BB21
		// (set) Token: 0x06001D8C RID: 7564 RVA: 0x0008D929 File Offset: 0x0008BB29
		public byte[] SendBytes { get; set; }
	}
}
